package com.atguigu.lease.web.admin.service.impl;

import com.atguigu.lease.web.admin.vo.system.user.SystemUserInfoVo;
import com.atguigu.lease.web.admin.vo.system.user.SystemUserItemVo;
import com.atguigu.lease.web.admin.vo.system.user.SystemUserQueryVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atguigu.lease.model.entity.SystemUser;
import com.atguigu.lease.model.service.SystemUserService;
import com.atguigu.lease.web.admin.mapper.SystemUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 老韦
* @description 针对表【system_user(员工信息表)】的数据库操作Service实现
* @createDate 2024-08-16 18:28:23
*/
@Service
public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemUser>
    implements SystemUserService{

    @Autowired
    SystemUserMapper systemUserMapper;

    @Override
    public IPage<SystemUserItemVo> listPageBySystemUserQueryVo(IPage<SystemUserItemVo> page, SystemUserQueryVo queryVo) {

        return systemUserMapper.listPageBySystemUserQueryVo(page,queryVo);
    }

    @Override
    public SystemUserInfoVo getSystemUserInfoById(Long userId) {

        //新建对象vo
        SystemUserInfoVo systemUserInfoVo = new SystemUserInfoVo();

        SystemUser systemUser = super.getById(userId);
        systemUserInfoVo.setName(systemUser.getUsername());
        systemUserInfoVo.setAvatarUrl(systemUser.getAvatarUrl());

        return systemUserInfoVo;
    }
}




